package cn.xmu.j2ee.exp.mapper.manual;

import cn.xmu.j2ee.exp.mapper.manual.po.OrderItemPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface OrderItemMapper {
    @Select({
            "select",
            " `id`,`order_id`,`goods_sku_id`,`quantity`,`price`,",
            "`discount`,`name`,`coupon_activity_id`,`be_share_id`",
            "from order_item",
            "where `order_id` = #{orderId,jdbcType=BIGINT}"
    })
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
            @Result(column = "order_id", property = "orderId", jdbcType = JdbcType.BIGINT),
            @Result(column = "goods_sku_id", property = "goodsSkuId", jdbcType = JdbcType.BIGINT),
            @Result(column = "quantity", property = "quantity", jdbcType = JdbcType.INTEGER),
            @Result(column = "price", property = "price", jdbcType = JdbcType.BIGINT),
            @Result(column = "discount", property = "discount", jdbcType = JdbcType.BIGINT),
            @Result(column = "name", property = "name", jdbcType = JdbcType.VARCHAR),
            @Result(column = "coupon_activity_id", property = "couponActivityId", jdbcType = JdbcType.BIGINT),
            @Result(column = "be_share_id", property = "beShareId", jdbcType = JdbcType.BIGINT)
    })
    List<OrderItemPo> selectOrderItemByOrderId(Long orderId);
}
